package com.imchenio.springscheduleexample.instance01;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;

//@Component
@Slf4j
public class DeadLoopSchedule {

    @Scheduled(cron = "0/5 * * * * ?")
    @SneakyThrows
    public void run() {
        while(true) {
            log.info("run in 1 second");
            Thread.sleep(1000);
        }
    }

    @Scheduled(cron = "0/5 * * * * ?")
    @SneakyThrows
    public void runAfter() {
        log.info("run after in 5 second");
    }

}
